package com.ibsol.commands
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.ibsol.business.AddTraineeDelegate;
	import com.ibsol.model.AddTraineeModel;
	
	import flash.events.Event;
	
	import mx.rpc.IResponder;
	
	public class AddTraineeCommand implements ICommand, IResponder
	{
		private var model:AddTraineeModel = AddTraineeModel.getInstance();
		public function AddTraineeCommand()
		{

		}
		
		public function execute (event:CairngormEvent):void
		{
			var delegate:AddTraineeDelegate = new AddTraineeDelegate(this);
//			var addTraineeEvent:AddTraineeEvent = AddTraineeEvent(event);
			delegate.addTrainee(model.trainee);
		}
		
		public function result(data:Object):void
		{
			if(data)
			{
				model.traineeAC.addItem(data);
//				mx.controls.Alert.show("onresult");
			}
		}
		
		public function fault(info:Object):void
		{
			trace(info);
//			mx.controls.Alert.show("onfault");
		}

	}
}